home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2251 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: hickory.westol.com!news
  2. From: Mark Kintigh <breetai@oak.westol.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Mouse Routines using C/C++
  5. Date: Fri, 19 Jan 1996 16:07:59 -0800
  6. Organization: Westmoreland Online Inc.
  7. Message-ID: <3100325F.5D@oak.westol.com>
  8. NNTP-Posting-Host: pm118.westol.com
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b4a (Win16; I)
  13.  
  14. Jon Day wrote:
  15. > I have some simple routines to implement a mouse handler is assembler but
  16. > nothin in C or C++. Can anyone provide me with example code on how to set
  17. > up an interrupt handler for the mouse using only C?
  18. > I am working on a project that requires the use of the mouse but I want to
  19. > write the code only in C and not in assembler.
  20. > Any help is greatly appreciated and you can reply directly to me.
  21.  
  22.  
  23. I've written them origionally using int86(), but I find that in-line
  24. assembler code works 1000 times better.  Code like...
  25.  
  26.     int getmousestats(int *row, int *col)
  27.     {
  28.        int r, c, b;
  29.  
  30.        _asm
  31.        {
  32.           mov ax,0003h
  33.           int 33h
  34.           mov r,dx
  35.           mov c,cx
  36.           mov b,bx
  37.        }
  38.        *row=r;
  39.        *col=c;
  40.        return(b);
  41.     }
  42.  
  43. ...is short, sweet, and works nicely.  If you *really* want the 100% C
  44. version of the mouse routines I have I'll try to dig them up, but I 
  45. think I've trashed them in favor of the better functions.
  46. -- 
  47.      _____
  48.     /    /##                 breetai@oak.westol.com
  49.    /    /####                                                     ____
  50.   (| []/ o ##)    "We met the enemy, and they were'nt us, then   | _|||
  51. |\ \_/ /\   # /|  we faced a pannel of 'us' and found they were  ||  ||
  52. | \-\ ==== /-/ |                    the enemy."                   \\//
  53. ||\\ '----' //||                                                   \/
  54. || \\/    \// ||
  55.